/*
import java.util.Random;

public class SelectK {
    public int findKthLargest(int[] nums, int k) {
        int l=0,r=nums.length-1;
        Random random=new Random();
        while(l<r){
            int p=partition(nums,l,r,random);
            if(p==k)return nums[p];
            if(k<p)r=p-1;
            else l=p+1;
        }
        return -1;
    }

    private int partition(int[] nums,int l,int r,Random random){
        int p=random.nextInt(r-l+1)+l;
        swap(nums,l,p);
        //nums[l+1,i-1]<=v;    nums[j+1,r]>=v
        int i=l+1,j=r;
        while(true){
            while(i<=j&&nums[i]<nums[l])i++;
            while(i<=j&&nums[j]>nums[l])j--;
            if(i>=j)break;
            swap(nums,i,j);
            i++;
            j--;
        }
    }
    private void swap(int[] arr,int i,int j){
        int temp = arr[i];
        arr[i]=arr[j];
        arr[j]=arr[i];
    }
}
*/
